#include <bits/stdc++.h>

template <typename It, class Func>
It my_partition(It begin, It end, Func f) {
    if (begin == end)
        return begin;
    It iter = begin;
    for (It it = begin; it != end; ++it) {
        if (f(*it)) {
            std::iter_swap(iter, it);
            ++iter;
        }
    }
    return iter;
}

template <typename It, class Compare =
          std::less<typename std::iterator_traits<It>::value_type> >
void my_sort(It begin, It end, Compare comp = Compare()) {
    typedef typename std::iterator_traits<It>::value_type T;
    static std::minstd_rand eng;
    auto n = std::distance(begin, end);
    if (n <= 1)
        return;
    std::uniform_int_distribution<std::size_t> distr(0, n - 1);
    auto x = *std::next(begin, distr(eng));
    auto mid1 = my_partition(begin, end, [&x, comp] (const T &a) {
            return comp(a, x);
        });
    auto mid2 = my_partition(mid1, end, [&x, comp] (const T &a) {
            return !comp(x, a);
        });
    my_sort(begin, mid1, comp);
    my_sort(mid2, end, comp);
}

template <typename T>
std::vector<T> read_array(std::istream &in=std::cin) {
    int n;
    in >> n;
    std::vector<T> result(n);
    for (int i = 0; i < n; ++i) {
        std::cin >> result[i];
    }
    return result;
}

int main() {
    auto a = read_array<int>();
    my_sort(a.begin(), a.end());
    std::copy(a.begin(), a.end(), std::ostream_iterator<int>(std::cout, " "));
    std::cout << std::endl;
}
